package com.redmaple.controller;

import com.redmaple.entity.User;
import com.redmaple.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

	@Autowired
	private UserService userService;

	@RequestMapping("/findUser")
	public List<User> findUser() {
        userService.insertUser("test_test", 999);
		return userService.findUser();
	}

	@RequestMapping("/insertUser")
	public List<User> insertUser(String name,Integer age) {
		return userService.insertUser(name, age);
	}

	@GetMapping("/index")
	public String index(){
	    return "This is my first mycat!";
    }

}
